import { request } from '@umijs/max';
import { AssignmentsParams, AssignmentsResult } from './model/assignmentsModel';
/** 获取分配 POST  */
export async function assignmentsSearch(
  params: AssignmentsParams,
  options?: { [key: string]: any },
) {
  return request<AssignmentsResult>(API_URL + '/superlink/api/assignments/search', {
    method: 'POST',
    params,
    data: {
      areaTokens: [],
      assetTokens: [],
      assignmentStatuses: [],
      deviceTypeTokens: [],
    },
    ...(options || {}),
  });
}
/** 释放 POST  */
export async function assignmentsEnd(id: string) {
  return request<API.AssResult>(API_URL + `/superlink/api/assignments/${id}/end`, {
    method: 'POST',
  });
}
/** 释放 POST  */
export async function createAssignments(data: API.CreateAssignmentsparams) {
  return request(API_URL + `/superlink/api/assignments/create`, {
    method: 'POST',
    params: {
      userId: data.userId,
    },
    data,
  });
}
export async function delItem(id: string) {
  return request(API_URL + `/superlink/api/assignments/delete/${id}`, {
    method: 'DELETE',
  });
}
